var dataxs={
    tgjh:{
       dataSet:[
            ['车险','123433','1213','123433','1213','百度','67213'],
            ['汽车保险','1234','67213','123433','1213','360','67213'],
            ['车险计算器','12232','6513','123433','1213','搜狗','67213'],
            ['汽车保险计算器','2213','3513','123433','1213','应用宝','67213'],
            ['人保车险官网','67213','3453','123433','1213','华为市场','67213'],
            ['意外险','6513','34513','123433','1213','vivo市场','67213'],
            ['旅游险','86513','7653','123433','1213','asd','67213'],
            ['责任险','5313','5413','123433','1213','阿斯顿飞','67213'],
            ['家庭险','5413','6513','123433','1213','阿萨德舒服的','67213'],
            ['行李险','3513','12232','123433','1213','挂号费d','67213'],
            ['PICC','7653','123433','123433','1213','韩国的是','67213'],
            ['人保财险','3453','2213','123433','1213','很尴尬','67213'],
            ['中国人民财产保险股份有限公司','34513','2213','123433','1213','好过分','67213']
        ],
        columns:[
            { "title": "推广计划" },
            { "title": "展现次数" },
            { "title": "点击次数" },
            { "title": "点击率" },
            { "title": "总费用" },
            { "title": "媒体渠道" },
            { "title": "访问量" },
        ]
    },
    tjz:{
        dataSet:[
            ['车险','123433','1213','123433','1213','百度','67213'],
            ['汽车保险','1234','67213','123433','1213','360','67213'],
            ['车险计算器','12232','6513','123433','1213','搜狗','67213'],
            ['汽车保险计算器','2213','3513','123433','1213','应用宝','67213'],
            ['人保车险官网','67213','3453','123433','1213','华为市场','67213'],
            ['意外险','6513','34513','123433','1213','vivo市场','67213'],
            ['旅游险','86513','7653','123433','1213','asd','67213'],
            ['责任险','5313','5413','123433','1213','阿斯顿飞','67213'],
            ['家庭险','5413','6513','123433','1213','阿萨德舒服的','67213'],
            ['行李险','3513','12232','123433','1213','挂号费d','67213'],
            ['asdsf','7653','123433','123433','1213','韩国的是','67213'],
            ['人保财险','3453','2213','123433','1213','很尴尬','67213'],
            ['中国人民财产保险股份有限公司','34513','2213','123433','1213','好过分','67213']
        ],
        columns:[
            { "title": "推广组" },
            { "title": "展现次数" },
            { "title": "点击次数" },
            { "title": "点击率" },
            { "title": "总费用" },
            { "title": "媒体渠道" },
            { "title": "访问量" },
        ]
    },
    gjc:{
        dataSet:[
            ['车险','123433','1213','123433','1213','百度','67213'],
            ['汽车保险','1234','67213','123433','1213','360','67213'],
            ['车险计算器','12232','6513','123433','1213','搜狗','67213'],
            ['汽车保险计算器','2213','3513','123433','1213','应用宝','67213'],
            ['人保车险官网','67213','3453','123433','1213','华为市场','67213'],
            ['意外险','6513','34513','123433','1213','vivo市场','67213'],
            ['旅游险','86513','7653','123433','1213','asd','67213'],
            ['责任险','5313','5413','123433','1213','阿斯顿飞','67213'],
            ['家庭险','5413','6513','123433','1213','阿萨德舒服的','67213'],
            ['行李险','3513','12232','123433','1213','挂号费d','67213'],
            ['asdsf','7653','123433','123433','1213','韩国的是','67213'],
            ['人保财险','3453','2213','123433','1213','很尴尬','67213'],
            ['中国人民财产保险股份有限公司','34513','2213','123433','1213','好过分','67213']
        ],
        columns:[
            { "title": "关键词" },
            { "title": "展现次数" },
            { "title": "点击次数" },
            { "title": "点击率" },
            { "title": "总费用" },
            { "title": "媒体渠道" },
            { "title": "访问量" },
        ]
    },
    cy:{
        dataSet:[
            ['车险','123433','1213','123433','1213','百度','67213'],
            ['汽车保险','1234','67213','123433','1213','360','67213'],
            ['车险计算器','12232','6513','123433','1213','搜狗','67213'],
            ['汽车保险计算器','2213','3513','123433','1213','应用宝','67213'],
            ['人保车险官网','67213','3453','123433','1213','华为市场','67213'],
            ['意外险','6513','34513','123433','1213','vivo市场','67213'],
            ['旅游险','86513','7653','123433','1213','asd','67213'],
            ['责任险','5313','5413','123433','1213','阿斯顿飞','67213'],
            ['家庭险','5413','6513','123433','1213','阿萨德舒服的','67213'],
            ['行李险','3513','12232','123433','1213','挂号费d','67213'],
            ['asdsf','7653','123433','123433','1213','韩国的是','67213'],
            ['人保财险','3453','2213','123433','1213','很尴尬','67213'],
            ['中国人民财产保险股份有限公司','34513','2213','123433','1213','好过分','67213']
        ],
        columns:[
            { "title": "创意" },
            { "title": "展现次数" },
            { "title": "点击次数" },
            { "title": "点击率" },
            { "title": "总费用" },
            { "title": "媒体渠道" },
            { "title": "访问量" },
        ]
    }
}


$("#btn>button").click(function(){
	console.log(this.innerHTML)
})
echarts_more();


$("#btn_two>button").click(function(){
    if(this.innerHTML=='推广计划'){
        $('#table_id_example').html("");
        Refresh(dataxs.tgjh.dataSet,dataxs.tgjh.columns);
    }else if(this.innerHTML=='推广组'){
        $('#table_id_example').html("");
         Refresh(dataxs.tjz.dataSet,dataxs.tjz.columns);
    }else if(this.innerHTML=='关键词'){
        $('#table_id_example').html("");
         Refresh(dataxs.gjc.dataSet,dataxs.gjc.columns);
    }else if(this.innerHTML=='创意'){
        $('#table_id_example').html("");
         Refresh(dataxs.cy.dataSet,dataxs.cy.columns);
    }else if(this.innerHTML=='成品效果图'){
        // alert('wer')
        // console.log();
        $('#table_id_example').html("");
         // $('#table_id_example').innerHTML=null;
         $('#table_id_example').html("<h4>最后有增加/删除行列功能</h4><br/><img src='../add/img/dong.gif' style='width:100%;height:100%;'/>")
    }
})

Refresh(dataxs.tgjh.dataSet,dataxs.tgjh.columns);

var table =null;
function Refresh(dataSet,columns){

    table=$('#table_id_example').dataTable( {
        "data": dataSet,
        "destroy": true,
        "oLanguage": {
            "sLengthMenu": "每页显示 _MENU_ 条记录",
            "sZeroRecords": "没有检索到数据",
            "sInfo": "当前数据为从第 _START_ 到第 _END_ 条数据；总共有 _TOTAL_ 条记录",
            "sInfoEmtpy": "没有数据",
            "sProcessing": "正在加载数据...",
            "oPaginate": {
                "sFirst": "首页",
                "sPrevious": "前页",
                "sNext": "后页",
                "sLast": "尾页"
            }
        },
        "columns": columns
    } ); 
}




function echarts_more(){
	// 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('echarts_more'));
	option = {
	    backgroundColor:'#ffffff',
	    tooltip: {
	        trigger: 'axis'
	    },
	    legend: {
	        data:['检查主体数']
	    },
	    grid: {
	        left: '3%',
	        right: '4%',
	        bottom: '3%',
	        containLabel: true
	    },
	    toolbox: {
	        feature: {
	            saveAsImage: {}
	        }
	    },
	    xAxis: {
	        type: 'category',
	        boundaryGap: false,
	        data: ['1月','2月','3月','4月','5月','6月','7月','8月','9月','10月','11月','12月']
	    },
	    yAxis: {
	        type: 'value',
	        name: '主体数',
	        min: 0,
	        max: 3000
	    },
	    series: [
	        {
	            name:'检查主体数',
	            type:'line',
	            stack: '总量',
	            data:[1422, 1522, 1622, 1422, 1522, 1122, 1422, 1322, 1422, 1352, 1022, 922, 822, 1222],
	            markPoint : {
	                color:'blue',
	                data : [
	                    {type : 'max', name : '最大值'},
	                     {type : 'min', name : '最小值'}
	                ]
	            },
	            markLine : {
	                data : [
	                    {type : 'average', name : '平均值'}
	                ]
	            }
	        }
	    ]
	};

	// 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
    window.addEventListener("resize",function(){
        myChart.resize();
    });    
}
